﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using ExcelMapper;
using Nomina.Utils.Test;
using System.IO;

namespace ExcelMapper.Test
{
    [TestClass]
    public class MapperTest
    {
        [TestMethod]
        public void ConvertFileToClass()
        {
            var fake = new FakeData();
            var mapper = new ExcelMap();
            var result = mapper.LoadExcel(fake.GetExcelFake(), 1, 0);
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(List<IDictionary<string, object>>));
            Assert.AreEqual(10, result.Count);
            Assert.AreEqual("AA", result[0]["Cabecera 2"]);

        }

        [TestMethod]
        public void ConvertFilePathToClass()
        {
            var path = Directory.GetCurrentDirectory();
            string filePath = path + @"\FakeData\ExcelFake.xlsx";
             var mapper = new ExcelMap();
            var result = mapper.LoadExcel(filePath, 1, 0);
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(List<IDictionary<string, object>>));
            Assert.AreEqual(10, result.Count);
            Assert.AreEqual("AA", result[0]["Cabecera 2"]);

        }
    }
}
